package com.ruoyi.neusoft.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.neusoft.domain.AiIdentifyModelVersionT;
import com.ruoyi.neusoft.service.IAiIdentifyModelVersionTService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 智能AI识别模型版本管理Controller
 * 
 * @author ruoyi
 * @date 2024-01-07
 */
@Controller
@RequestMapping("/AI/VersionService")
public class AiIdentifyModelVersionTController extends BaseController
{
    private String prefix = "AI/VersionService";

    @Autowired
    private IAiIdentifyModelVersionTService aiIdentifyModelVersionTService;

    @RequiresPermissions("AI:VersionService:view")
    @GetMapping()
    public String VersionService()
    {
        return prefix + "/VersionService";
    }

    /**
     * 查询智能AI识别模型版本管理列表
     */
    @RequiresPermissions("AI:VersionService:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AiIdentifyModelVersionT aiIdentifyModelVersionT)
    {
        startPage();
        List<AiIdentifyModelVersionT> list = aiIdentifyModelVersionTService.selectAiIdentifyModelVersionTList(aiIdentifyModelVersionT);
        return getDataTable(list);
    }

    /**
     * 导出智能AI识别模型版本管理列表
     */
    @RequiresPermissions("AI:VersionService:export")
    @Log(title = "智能AI识别模型版本管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AiIdentifyModelVersionT aiIdentifyModelVersionT)
    {
        List<AiIdentifyModelVersionT> list = aiIdentifyModelVersionTService.selectAiIdentifyModelVersionTList(aiIdentifyModelVersionT);
        ExcelUtil<AiIdentifyModelVersionT> util = new ExcelUtil<AiIdentifyModelVersionT>(AiIdentifyModelVersionT.class);
        return util.exportExcel(list, "智能AI识别模型版本管理数据");
    }

    /**
     * 新增智能AI识别模型版本管理
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存智能AI识别模型版本管理
     */
    @RequiresPermissions("AI:VersionService:add")
    @Log(title = "智能AI识别模型版本管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AiIdentifyModelVersionT aiIdentifyModelVersionT)
    {
        return toAjax(aiIdentifyModelVersionTService.insertAiIdentifyModelVersionT(aiIdentifyModelVersionT));
    }

    /**
     * 修改智能AI识别模型版本管理
     */
    @RequiresPermissions("AI:VersionService:edit")
    @GetMapping("/edit/{versionId}")
    public String edit(@PathVariable("versionId") Long versionId, ModelMap mmap)
    {
        AiIdentifyModelVersionT aiIdentifyModelVersionT = aiIdentifyModelVersionTService.selectAiIdentifyModelVersionTByVersionId(versionId);
        mmap.put("aiIdentifyModelVersionT", aiIdentifyModelVersionT);
        return prefix + "/edit";
    }

    /**
     * 修改保存智能AI识别模型版本管理
     */
    @RequiresPermissions("AI:VersionService:edit")
    @Log(title = "智能AI识别模型版本管理", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AiIdentifyModelVersionT aiIdentifyModelVersionT)
    {
        return toAjax(aiIdentifyModelVersionTService.updateAiIdentifyModelVersionT(aiIdentifyModelVersionT));
    }

    /**
     * 删除智能AI识别模型版本管理
     */
    @RequiresPermissions("AI:VersionService:remove")
    @Log(title = "智能AI识别模型版本管理", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(aiIdentifyModelVersionTService.deleteAiIdentifyModelVersionTByVersionIds(ids));
    }
}
